/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.openbrew.openbrewrf;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author chapmand
 */
@Entity
@Table(name = "Movement")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Movement.findAll", query = "SELECT m FROM Movement m"),
    @NamedQuery(name = "Movement.findByMovementID", query = "SELECT m FROM Movement m WHERE m.movementID = :movementID"),
    @NamedQuery(name = "Movement.findByMovementDate", query = "SELECT m FROM Movement m WHERE m.movementDate = :movementDate"),
    @NamedQuery(name = "Movement.findByMovementBrewID", query = "SELECT m FROM Movement m WHERE m.movementBrewID = :movementBrewID"),
    @NamedQuery(name = "Movement.findByMovementOldState", query = "SELECT m FROM Movement m WHERE m.movementOldState = :movementOldState"),
    @NamedQuery(name = "Movement.findByMovementStateID", query = "SELECT m FROM Movement m WHERE m.movementStateID = :movementStateID"),
    @NamedQuery(name = "Movement.findByMovementVolume", query = "SELECT m FROM Movement m WHERE m.movementVolume = :movementVolume"),
    @NamedQuery(name = "Movement.findByMovementEmpID", query = "SELECT m FROM Movement m WHERE m.movementEmpID = :movementEmpID"),
    @NamedQuery(name = "Movement.findByMovementNotes", query = "SELECT m FROM Movement m WHERE m.movementNotes = :movementNotes"),
    @NamedQuery(name = "Movement.findByMovementOVID", query = "SELECT m FROM Movement m WHERE m.movementOVID = :movementOVID"),
    @NamedQuery(name = "Movement.findByMovementNVID", query = "SELECT m FROM Movement m WHERE m.movementNVID = :movementNVID")})
public class Movement implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "MovementID")
    private Integer movementID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "MovementDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date movementDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "MovementBrewID")
    private int movementBrewID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "MovementOldState")
    private int movementOldState;
    @Basic(optional = false)
    @NotNull
    @Column(name = "MovementStateID")
    private int movementStateID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "MovementVolume")
    private float movementVolume;
    @Basic(optional = false)
    @NotNull
    @Column(name = "MovementEmpID")
    private int movementEmpID;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 250)
    @Column(name = "MovementNotes")
    private String movementNotes;
    @Basic(optional = false)
    @NotNull
    @Column(name = "MovementOVID")
    private int movementOVID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "MovementNVID")
    private int movementNVID;
    @OneToMany
    @JoinTable(
        name="JTMvmt",
        joinColumns={ @JoinColumn(name="MovementID", referencedColumnName="MovementID")},
        inverseJoinColumns={ @JoinColumn(name="equipID", referencedColumnName="equipID", unique=true)}
    )
    private List<Equipment> equipmentCollection;

    public Movement() {
    }

    public Movement(Integer movementID) {
        this.movementID = movementID;
    }

    public Movement(Integer movementID, Date movementDate, int movementBrewID, int movementOldState, int movementStateID, float movementVolume, int movementEmpID, String movementNotes, int movementOVID, int movementNVID) {
        this.movementID = movementID;
        this.movementDate = movementDate;
        this.movementBrewID = movementBrewID;
        this.movementOldState = movementOldState;
        this.movementStateID = movementStateID;
        this.movementVolume = movementVolume;
        this.movementEmpID = movementEmpID;
        this.movementNotes = movementNotes;
        this.movementOVID = movementOVID;
        this.movementNVID = movementNVID;
    }

    public Integer getMovementID() {
        return movementID;
    }

    public void setMovementID(Integer movementID) {
        this.movementID = movementID;
    }

    public Date getMovementDate() {
        return movementDate;
    }

    public void setMovementDate(Date movementDate) {
        this.movementDate = movementDate;
    }

    public int getMovementBrewID() {
        return movementBrewID;
    }

    public void setMovementBrewID(int movementBrewID) {
        this.movementBrewID = movementBrewID;
    }

    public int getMovementOldState() {
        return movementOldState;
    }

    public void setMovementOldState(int movementOldState) {
        this.movementOldState = movementOldState;
    }

    public int getMovementStateID() {
        return movementStateID;
    }

    public void setMovementStateID(int movementStateID) {
        this.movementStateID = movementStateID;
    }

    public float getMovementVolume() {
        return movementVolume;
    }

    public void setMovementVolume(float movementVolume) {
        this.movementVolume = movementVolume;
    }

    public int getMovementEmpID() {
        return movementEmpID;
    }

    public void setMovementEmpID(int movementEmpID) {
        this.movementEmpID = movementEmpID;
    }

    public String getMovementNotes() {
        return movementNotes;
    }

    public void setMovementNotes(String movementNotes) {
        this.movementNotes = movementNotes;
    }

    public int getMovementOVID() {
        return movementOVID;
    }

    public void setMovementOVID(int movementOVID) {
        this.movementOVID = movementOVID;
    }

    public int getMovementNVID() {
        return movementNVID;
    }

    public void setMovementNVID(int movementNVID) {
        this.movementNVID = movementNVID;
    }

    public List<Equipment> getEquipmentCollection() {
        return equipmentCollection;
    }

    public void setEquipmentCollection(List<Equipment> equipmentCollection) {
        this.equipmentCollection = equipmentCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (movementID != null ? movementID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Movement)) {
            return false;
        }
        Movement other = (Movement) object;
        if ((this.movementID == null && other.movementID != null) || (this.movementID != null && !this.movementID.equals(other.movementID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.Movement[ movementID=" + movementID + " ]";
    }
    
}
